package com.example.service.dubbo.impl;

import org.apache.dubbo.config.annotation.DubboService;

import com.example.model.dubbo.Stock;
import com.example.service.dubbo.WarehouseService;

@DubboService(version = "1.0.0")
public class WarehouseServiceImpl implements WarehouseService {

	@Override
	public Stock getStock(Long skuId) {
		Stock stock = null;
		if (skuId == 1101l) {
			// 模拟有库存商品
			stock = new Stock(1101l, "Apple iPhone 11 128GB 紫色", 32, "台");
			stock.setDescription("Apple 11 紫色版对应商品描述");
		} else if (skuId == 1102l) {
			// 模拟无库存商品
			stock = new Stock(1102l, "Apple iPhone 11 256GB 白色", 0, "台");
			stock.setDescription("Apple 11 白色版对应商品描述");
		} else {
			// 演示案例，暂不考虑无对应skuId的情况
		}
		return stock;
	}

}
